home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 4 / Mac Giga-ROM 4.0 - 1993.toast / FILES / DEV / I-Z / Progress Tube Unit.cpt / Progress Tube Unit Folder / TubeExample.c < prev    next >
Text File  |  1992-12-31  |  2KB  |  65 lines

  1. /*====================================================================================*/
  2.  
  3. #include "ProgressTube.h"
  4.  
  5. main()
  6. {    
  7.     short        loop,x;
  8.     TubeType    Tube1,
  9.                 Tube2;
  10.     Str255        String1    =    "\pDoing something extremely interesting in the background...",
  11.                 String2    =    "\pFinishing up background tasks...                            ";
  12.     float        PercentageA,
  13.                 PercentageB;
  14.     
  15.     ToolboxInit(); /* MAKE SURE everything is initialized before using this unit */
  16.  
  17.     
  18.     /* check below if a new window could be allocated for the tube! VERY important! */
  19.     if (NewTube( &Tube1, "\pTestTube" ) != noErr)     
  20.         exit();                                        
  21.                                                        
  22.     if (NewTube( &Tube2, "\pTestTube" ) != noErr)
  23.         exit(); 
  24.  
  25.     MoveWindow ( Tube2.tubeWindow, defaultRect.left+60, defaultRect.top+160, TRUE );    
  26.  
  27.     for (loop=0; loop<=100; loop+=20)
  28.     {
  29.         if (loop> 80) strcpy(String1, String2);     
  30.         PercentageA    =    loop * .01;    
  31.         FillTube(Tube1, String1, &PercentageA);        
  32.  
  33.         ResetTube( Tube2 );
  34.         for (x=0; x<=100; x++)
  35.         {
  36.             PercentageB    =    x * .01;
  37.             FillTube(Tube2, "\pWasting time repeatedly in the foreground...", &PercentageB);            
  38.         }
  39.     }
  40.     
  41.     while(!Button());
  42.     
  43.     DisposeTube(Tube1);
  44.     DisposeTube(Tube2);
  45.  
  46. }
  47.  
  48. ToolboxInit()
  49. {
  50.     #define     Remove_All_Events    0
  51.  
  52.     InitGraf(&thePort);
  53.     InitFonts();
  54.     FlushEvents(everyEvent,Remove_All_Events);
  55.     InitWindows();
  56.     InitMenus();
  57.     TEInit();
  58.     InitDialogs(NULL);
  59.     InitCursor();
  60.     MoreMasters();                     /* This reserves space for more handles */
  61.     MaxApplZone();                  /* Give us room for memory allocation */
  62.     
  63. }
  64.  
  65.